package dao;

import java.util.List;

import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import pojo.EssayAndUser;
import pojo.Essay;
import pojo.Page;

public interface EssayDao {

    //显示所有人可见的文章
    @Select(value = "select * from essay where permission=#{permission}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> findalleassy(String permission);

    //显示仅用户可见和全部可见的文章
    @Select(value = "select * from essay where permission!=#{permission}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectBuserEssay(String permission);

    //显示仅自己可见的文章
    @Select(value = "select * from essay where permission=#{permission}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> SelectBselfEssay(String permission);

    // 根据essayId查找文章/有限制/未登录/不带user信息
    @Select(value = "select * from essay where essay_id=#{essayId} and permission=#{permission} LIMIT 7")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
    })
    public Essay FindEssayByEssayIdLimitLogout(@Param("essayId") Integer essayId, @Param("permission") String permission);

    // 根据essayId查找文章/有限制/已登录/不带user信息
    @Select(value = "select * from essay where essay_id=#{essayId} and permission!=#{permission} LIMIT 7")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"),
            @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
    })
    public Essay FindEssayByEssayIdLimitlogin(@Param("essayId") Integer essayId, @Param("permission") String permission);

    // 根据essayId查找文章/无限制/带user信息
    @Select(value = "select * from essay where essay_id=#{essayId}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))
    })
    public EssayAndUser FindEssayByEssayId(@Param("essayId") Integer essayId);


    //根据ID 查找文章/不带user信息
    @Select(value = "select * from essay where essay_id=#{essayId}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))
    })
    public Essay FindEssayByEssayID(@Param("essayId") Integer essayId);

    //根据用户ID查找文章
    @Select(value = "select * from essay where user_id=#{userId} limit #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date")})
    public List<Essay> FindEssayByUser(@Param("userId") Integer userId,@Param("page") Page page);

    //根据用户ID查找文章数量
    @Select(value = "select count(*) from essay where user_id=#{userId}")
    public Integer FindEssayByUserCount(@Param("userId") Integer userId);


    //根据发布日期显示分页条数据/未登录，显示所有人可见/未登录主页显示
    @Select(value = "SELECT * FROM essay where permission=#{permission} ORDER BY publish_date DESC  LIMIT #{page.currentPage},#{page.limitNumber} ")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> findLimitEssay(@Param("permission") String permission,@Param("page") Page page);

    //根据发布日期显示分页条数据/未登录，显示所有人可见/未登录主页显示/数量
    @Select(value = "SELECT count(*) FROM essay where permission=#{permission}")
    public int findLimitEssayCount(@Param("permission") String permission);


    //根据发布日期显示近15条数据/登录，不显示仅自己可见/按最新显示/已登录主页显示
    @Select(value = "SELECT * FROM essay where permission!=#{permission} ORDER BY publish_date DESC LIMIT #{page.currentPage},#{page.limitNumber} ")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> findLimitEssayP(@Param("permission") String permission,@Param("page") Page page);

    //根据发布日期显示近分页条数据/登录，不显示仅自己可见/按最新显示/已登录主页显示/数量
    @Select(value = "SELECT count(*) FROM essay where permission!=#{permission}   ")
    public int findLimitEssayPCount(@Param("permission") String permission);


    //根据类别显示15条数据/未登录，显示所有人可见/按最新排序
    @Select(value = "SELECT * FROM essay WHERE category=#{category} and permission=#{permission} ORDER BY publish_date DESC  LIMIT #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> findLimitEssaySelect(@Param("category") String category, @Param("permission") String permission,@Param("page")Page page);

    //根据类别显示分页数据/未登录，显示所有人可见/按最新排序/数量
    @Select(value = "SELECT count(*) FROM essay WHERE category=#{category} and permission=#{permission}")
    public int findLimitEssaySelectCount(@Param("category") String category, @Param("permission") String permission);


    //根据类别显示15条数据/已登录，不现实自己仅可见/按最新排序
    @Select(value = "SELECT * FROM essay WHERE category=#{category} and permission!=#{permission} ORDER BY publish_date DESC  LIMIT #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> findLimitEssaySelectBself(@Param("category") String category, @Param("permission") String permission,@Param("page")Page page);

    //根据类别显示15条数据/已登录，不现实自己仅可见/按最新排序/数量
    @Select(value = "SELECT count(*) FROM essay WHERE category=#{category} and permission!=#{permission} ")
    public int findLimitEssaySelectBselfCount(@Param("category") String category, @Param("permission") String permission);


    //根据类别显示15条数据/未登录，显示所有人可见/按点赞量排序
    @Select(value = "SELECT * FROM essay WHERE category=#{category} and permission=#{permission} ORDER BY like_number DESC  LIMIT #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectEssayByCategoryAndPraiseLogout(@Param("category") String category, @Param("permission") String permission,@Param("page")Page page);

    //根据类别显示15条数据/未登录，显示所有人可见/按点赞量排序/数量
    @Select(value = "SELECT count(*) FROM essay WHERE category=#{category} and permission=#{permission} ")
    public int selectEssayByCategoryAndPraiseLogoutCount(@Param("category") String category, @Param("permission") String permission);


    //根据类别显示15条数据/已登录，不显示仅自己可见/按点赞量/类别排序
    @Select(value = "SELECT * FROM essay WHERE category=#{category} and permission!=#{permission} ORDER BY like_number DESC  LIMIT #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectEssayByCategoryAndPraiseLogin(@Param("category") String category, @Param("permission") String permission,@Param("page")Page page);

    //根据类别显示15条数据/已登录，不显示仅自己可见/按点赞量/类别排序
    @Select(value = "SELECT count(*) FROM essay WHERE category=#{category} and permission!=#{permission} ")
    public int selectEssayByCategoryAndPraiseLoginCount(@Param("category") String category, @Param("permission") String permission);


    //根据发布日期和评论数量显示7条数据/未登录只显示所有人可见
    @Select(value = "SELECT * FROM essay where permission=#{permission}  ORDER BY comment_number DESC,publish_date DESC LIMIT 7 ")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectByCommenNumber(@Param("startDate") String startDate, @Param("permission") String permission);

    //根据发布日期和评论数量显示7条数据/已登录，不显示仅自己可见
    @Select(value = "SELECT * FROM essay where permission!=#{permission}  ORDER BY comment_number DESC,publish_date DESC LIMIT 7")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectByCommenNumberLimit(@Param("startDate") String startDate, @Param("permission") String permission);

    //显示已知用户的近7条数据/未登录
    @Select(value = "SELECT * FROM essay where user_id=#{userId}  ORDER BY publish_date DESC LIMIT 7")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"),
            @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date")})
    public List<Essay> selectByDateNoLimit(@Param("userId") Integer userId);

    //显示已知用户的近7条数据/未登录
    @Select(value = "SELECT * FROM essay where user_id=#{userId} and permission=#{permission} ORDER BY publish_date DESC LIMIT 7")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"),
            @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date")})
    public List<Essay> selectByDate(@Param("userId") Integer userId, @Param("permission") String permission);

    //显示已知用户的近7条数据/已登陆
    @Select(value = "SELECT * FROM essay where user_id=#{userId} and permission!=#{permission}  ORDER BY publish_date DESC LIMIT 7")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"),
            @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date")})
    public List<Essay> selectByDateLimit(@Param("userId") Integer userId, @Param("permission") String permission);

    //模糊查询/已登陆状态
    @Select(value = "select * from essay where permission!=#{permission} and  title like '%${text}%' limit #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"),
            @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectEssayBySearchLogin(@Param("text") String text, @Param("permission") String permission,@Param("page")Page page);


    //模糊查询/已登陆状态/数量
    @Select(value = "select count(*) from essay where permission!=#{permission} and  title like '%${text}%'")
    public int selectEssayBySearchLoginCount(@Param("text") String text, @Param("permission") String permission);


    //模糊查询/未登录模式
    @Select(value = "select * from essay where permission=#{permission} and title like '%${text}%' limit #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"),
            @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectEssayBySearchLogout(@Param("text") String text, @Param("permission") String permission,@Param("page")Page page);

    //模糊查询/未登录模式/数量
    @Select(value = "select count(*) from essay where permission=#{permission} and title like '%${text}%'")
    public int selectEssayBySearchLogoutCount(@Param("text") String text, @Param("permission") String permission);


    //根据文章id查找用户Id
    @Select(value = "select user_id from essay where essay_id=#{essayId}")
    @Results({
            @Result(property = "userId", column = "user_id")
    })
    public int selectuserId(Integer essayId);


    //显示管理员可一查看的文章/所有
    @Select(value = "select * from essay limit #{currentPage},#{limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"),
            @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectManagerEssay(Page page);

    //显示文章按点赞量排序/未登录/综合类别
    @Select(value = "SELECT * FROM essay where permission=#{permission} ORDER BY like_number DESC  LIMIT #{page.currentPage},#{page.limitNumber} ")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectEssayByPraiseLogout(@Param("permission") String permission,@Param("page") Page page);

    //显示文章按点赞量排序/未登录/综合类别/数量
    @Select(value = "SELECT count(*) FROM essay where permission=#{permission} ")
    public int selectEssayByPraiseLogoutCount(@Param("permission") String permission);


    //显示文章按点赞量排序/已登录/综合类别
    @Select(value = "SELECT * FROM essay where permission!=#{permission} ORDER BY like_number DESC   LIMIT #{page.currentPage},#{page.limitNumber} ")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> selectEssayByPraiseLogin(@Param("permission") String permission,@Param("page") Page page);

    //显示文章按点赞量排序/已登录/综合类别
    @Select(value = "SELECT count(*) FROM essay where permission!=#{permission}")
    public int selectEssayByPraiseLoginCount(@Param("permission") String permission);


    //管理员查看/已审核文章/未审核文章
    @Select(value = "SELECT * FROM essay WHERE auditing = #{auditing} limit #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public  List<EssayAndUser> selectManagerEssayByAuditing(@Param("auditing") Integer auditing,@Param("page") Page page);

    //查询其他用户的所有文章/不显示仅自己可见
    @Select(value = "SELECT * FROM essay WHERE user_id = #{userId} and permission!=#{permission} limit #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> SelectOtherUserEssayLogin(@Param("userId")Integer userId,@Param("permission") String permission,@Param("page") Page page);

    //查询其他用户的所有文章数量/不显示仅自己可见
    @Select(value = "SELECT count(*) FROM essay WHERE user_id = #{userId} and permission!=#{permission}")
    public Integer SelectOtherUserEssayCountLogin(@Param("userId")Integer userId,@Param("permission") String permission);


    //查询其他用户的所有文章/不显示仅自己可见
    @Select(value = "SELECT * FROM essay WHERE user_id = #{userId} and permission==#{permission} limit #{page.currentPage},#{page.limitNumber}")
    @Results({@Result(property = "essayId", column = "essay_id", id = true),
            @Result(property = "userId", column = "user_id"), @Result(property = "readNumber", column = "read_number"),
            @Result(property = "likeNumber", column = "like_number"),
            @Result(property = "treadNumber", column = "tread_number"),
            @Result(property = "commentNumber", column = "comment_number"),
            @Result(property = "publishDate", column = "publish_date"),
            @Result(property = "user", column = "user_id", one = @One(select = "dao.UserMapper.selectByPrimaryKey"))})
    public List<EssayAndUser> SelectOtherUserEssaylogout(@Param("userId")Integer userId,@Param("permission") String permission,@Param("page") Page page);

    //查询其他用户的所有文章数量/不显示仅自己可见
    @Select(value = "SELECT count(*) FROM essay WHERE user_id = #{userId} and permission==#{permission} ")
    public Integer SelectOtherUserEssayCountlogout(@Param("userId")Integer userId,@Param("permission") String permission);
}
